<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../../vue.js"></script>
    <link rel="stylesheet" href="./a.css" />
</head>

<body>
    <div id="app">
        <ul>
            <li v-for="(item, index) in list" :class="pink===index?'pink':''" @click="add(index)">
                {{item}}
            </li>
        </ul>
    </div>
    <script>
        new Vue({
            el: "#app",
            data: {
                list: ["首页", "我的", "返回", "电影", "影院"],
                pink: 0,
            },
            methods: {
                add(index) {
                    console.log("add", index);
                    this.pink = index;
                },
            },
        });
    </script>

    <!-- <ul id="app">
        <li v-for="(item,index) in list" :class="red===index?'red':''" @click="ys(index)">
            {{item}}
        </li>
    </ul>
    <script>
        new Vue({
            el: "#app",
            data: {
                list: ["a", "b", "c"],
                // ys: "red",
                red: 0,
            },
            methods: {
                ys(index) {
                    this.red = index;
                },
            },
        });
    </script> -->
</body>

</html>